<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Topic extends Model
{

    protected $table = 'topic';
    public $timestamps = false;

    

    /**
     * 查找该话题被多少人关注了
     */
    public function getFocusByTopic()
    {
    	return $this->belongsToMany('App\User', 'topfocus', 'topic_id', 'user_id');
    }

    /**
     * 查找该话题下的所有问题
     */
    public function getQuestionByTopic()
    {
    	return $this->belongsToMany('App\Question', 'topic_question', 'topic_id', 'question_id');
    }
}
